package com.liang.controller;


import com.liang.mall.entity.Menu;
import com.liang.mall.util.ResultEntity;
import com.liang.service.MenuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import org.springframework.stereotype.Controller;

import java.util.List;

/**
 * <p>
 * 菜单管理 前端控制器
 * </p>
 *
 * @author lin
 * @since 2021-05-07
 */
@RestController
public class MenuController {

    @Autowired
    MenuService menuService;

    @GetMapping("/menu/list")
    public ResultEntity<List<Menu>> getAllMenu(){
        List<Menu> menus = menuService.selectMenuAll();

        return ResultEntity.ok(menus);
    }


    @GetMapping("/menu/getAll")
    public ResultEntity getMenu(){

        List<Menu> allMenu = menuService.getAllMenu();

        return ResultEntity.ok(allMenu);


    }

    @GetMapping("/menu/{id}")
    public ResultEntity getMenuById(@PathVariable("id") Integer id){

        Integer[] menuListID =    menuService.getMenuById(id);


        return ResultEntity.ok(menuListID);


    }
    


}

